import request from '@/utils/request'

// 存储设备

//  "获取所有的存储设备)",
export function getAllDevice (params) {
	return request({
		url: '/Devices',
		method: 'get',
		params
	})
}

//  "根据机构获取对应的存储)",
export function getDeviceByorg (params) {
	return request({
		url: '/Devices/by-orgcode',
		method: 'get',
		params
	})
}

//  "获取单个的存储设备",
export function getDetail (params) {
	return request({
		url: `/Devices/${params.id}/detail`,
		method: 'get'
	})
}

//  "删除设备",
export function deleteDevice (params) {
	return request({
		url: '/Devices/{id}',
		method: 'delete'
	})
}

//  "修改",
export function editDevice (data) {
	return request({
		url: `/Devices/${data.id}`,
		method: 'put',
		data
	})
}

//修改状态,
export function changeDeviceStatus (data) {
	return request({
		url: `/Devices/${data.id}`,
		method: 'put',
		data
	})
}

// 通过id 获取相关存储域,
export function get_relate_domains (data) {
	return request({
		url: `/Devices/${data.id}/domains`,
		method: 'get',
		data
	})
}

// 添加存储设备
export function addDevice (data) {
	return request({
		url: '/Devices',
		method: 'post',
		data
	})
}

//  添加存储域
export function createDomain (data) {
	return request({
		url: '/Domains',
		method: 'post',
		data
	})
}

//修改存储域,
export function updateDomains (data) {
	return request({
		url: `/Domains/${data.id}`,
		method: 'put',
		data
	})
}
